<template>
  <div>
    <van-nav-bar
      title="ASUS"
      right-text="搜索"
      left-arrow
      @click-left="onClickLeft"
    />
    <el-carousel :interval="4000" type="card" height="230px">
      <el-carousel-item v-for="(v,item) in arr" :key="item">
        <img :src="v" class="img" >
      </el-carousel-item>
    </el-carousel>
    <div class="imgs" v-for="(v,index) in imgs" :key="index">
        <img :src="v" alt="">
    </div>
  </div>
</template>

<script>
import Vue from "vue";
import { NavBar } from "vant";
Vue.use(NavBar);
export default {
    data(){
        return{
            arr:[],
            imgs:[]
        }
    },
  methods: {
    onClickLeft() {
      this.$router.push({path:'/total'}).catch(err=>{})
    },
  },
  mounted() {
    this.$http({
        url:"http://localhost:3000/navigation8",
        method:"get"
    }).then(res=>{
        res.data.forEach(element => {
            this.imgs = element.data.img
            this.arr = element.data.swipe
        });
    })
  },
};
</script>

<style scoped>
.el-carousel__item h3 {
  color: #475669;
  font-size: 14px;
  opacity: 0.75;
  line-height: 200px;
  margin: 0;
}

.el-carousel__item:nth-child(2n) {
  background-color: #99a9bf;
}

.el-carousel__item:nth-child(2n + 1) {
  background-color: #d3dce6;
}
img {
  width: 100%;
  height: 100%;
}
.imgs{
    height: 400px;
    margin-bottom: 10px;
}
</style>